package com.bobbygu.server.simpleapp.mapper;

import com.bobbygu.server.simpleapp.model.ImgModel;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UploadMapper {
    @Select("select * from img_list where name = #{name}")
    ImgModel findImgByName(String name);

    @Update("update img_list set name=#{name},imgurl=#{imgurl},img_data=#{img_data},token=#{token}")
    void updateImg(@Param("name") String name, @Param("imgurl") String imgUrl, @Param("img_data") Object imgData, @Param("token") String token);

    @Insert("insert into img_list(name,img_data,token) values(#{name},#{img_data},#{token})")
    void upload(@Param("name") String name, @Param("img_data") Object imgData, @Param("token") String token);

    @Insert("insert into img_list(name,imgurl,img_data,token) values(#{name},#{imgurl},#{img_data},#{token})")
    void insertImg(@Param("name") String name, @Param("imgurl") Object imgUrl, @Param("img_data") Object imgData, @Param("token") String token);
}
